# -*- coding: utf-8 -*-
from pandas import DataFrame, Series
from core import threadLocal
from core.context import Context
from core.dataClasses import StockTradeDataColumnName
from core.enums import ThreadName


def close() -> Series:
    """
    收盘价
    :return:
    """
    context = Context.getInstance(threadLocal.get(ThreadName.CONTEXT.value))
    return context.getColumn(StockTradeDataColumnName.CLOSE.value)


def open() -> Series:
    """
    开盘价
    :return:
    """
    context = Context.getInstance(threadLocal.get(ThreadName.CONTEXT.value))
    return context.getColumn(StockTradeDataColumnName.OPEN.value)


def high() -> Series:
    """
    最高价
    :return:
    """
    context = Context.getInstance(threadLocal.get(ThreadName.CONTEXT.value))
    return context.getColumn(StockTradeDataColumnName.HIGH.value)


def low() -> Series:
    """
    最高价
    :return:
    """
    context = Context.getInstance(threadLocal.get(ThreadName.CONTEXT.value))
    return context.getColumn(StockTradeDataColumnName.LOW.value)


def vol() -> Series:
    """
    最高价
    :return:
    """
    context = Context.getInstance(threadLocal.get(ThreadName.CONTEXT.value))
    return context.getColumn(StockTradeDataColumnName.VOL.value)


def realtimeQuote() -> DataFrame:
    """
    最高价
    :return:
    """
    context = Context.getInstance(threadLocal.get(ThreadName.CONTEXT.value))
    return context.realtimeQuote()

